import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
import set from '@dfeidao/atom-web/local/set';
import set_nodes_cls from "@dfeidao/atom-web/ui/set-nodes-cls";
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import render from '@dfeidao/atom-web/render/render';
import p002 from './p002';
import set1 from '@dfeidao/atom-web/global/set';
export default async function a003(fd: IFeidaoAiBrowserComponent, e: Event) {
	// todo
	const d = e.currentTarget as HTMLDivElement;
	const nodes = fd.data.node.querySelectorAll('[data-name="hidden"]');
	const ns = Array.from(nodes) as HTMLDivElement[];
	set_nodes_cls(ns, 'bg-select', false);
	set_node_cls(d, 'bg-select', true);
	const v = d.getAttribute('data-v');
	const c = d.getAttribute('data-n');
	//const post_package = JSON.parse(v);
	set(fd, 'post_package', v);
	set(fd, '_id', [c]);
	set(fd, '_no', c);
	set1('post_package', v)
	console.log(c);
	const res = await nodejs<{ data: [{ _id: string }], x: number; }>('GuoKai/zj-000003/s002', {
		page_no: 1,
		post_package: v,

	});

	render(fd, res, p002, 'p002', 'inner');
	console.log('ssss', res);

}
